{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Oops - Object Oriented Porgramming "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- What is OOPs?\n",
    "\n",
    "- Why OOPs?\n",
    "\n",
    "- How is OOP is done ?\n",
    "\n",
    "- We have a Frame for Data, \n",
    "\n",
    "- and Data is been dumped here and we create multiple copies of Objects virtually with that frame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "class car(): \n",
    "    #Attributes \n",
    "    DOM = \"\"\n",
    "    Model = \"\"\n",
    "    Colour = \"\"\n",
    "    Price = 0\n",
    "    Wheels = \"\"\n",
    "\n",
    "    # THis is a different method which we want to have in our python class\n",
    "    def updatePrice(self, updatedPrice):\n",
    "        self.Price = updatedPrice    \n",
    "    \n",
    "    def showDetails(self):\n",
    "        print(self.DOM)\n",
    "        print(self.Model)    \n",
    "        print(self.Colour)\n",
    "        print(self.Price)\n",
    "        print(self.Wheels)\n",
    "    \n",
    "    # Whenever u define a New Object for this Class, this \n",
    "    # Particular Method calls first and define the by Default \n",
    "    # Values inside the COmputer Memory\n",
    "    def __init__(self, DOM, Model, Colour, Price, Wheels):\n",
    "        self.DOM = DOM\n",
    "        self.Model = Model\n",
    "        self.Colour = Colour\n",
    "        self.Price = Price\n",
    "        self.Wheels = Wheels\n",
    "        print(\"We have initiated the classes Object\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "We have initiated the classes Object\n"
     ]
    }
   ],
   "source": [
    "MGHector = car(\"7102015\",\"SUV\",\"BLUE\",4500000,\"4+1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'SUV'"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MGHector.Model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7102015\n",
      "SUV\n",
      "BLUE\n",
      "4500000\n",
      "4+1\n"
     ]
    }
   ],
   "source": [
    "MGHector.showDetails()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "MGHector.updatePrice(4600000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7102015\n",
      "SUV\n",
      "BLUE\n",
      "4600000\n",
      "4+1\n"
     ]
    }
   ],
   "source": [
    "MGHector.showDetails()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "We have initiated the classes Object\n"
     ]
    }
   ],
   "source": [
    "Verna = car(\"152311\",\"Sedan\",\"BLACK\",2000000,\"4+1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "152311\n",
      "Sedan\n",
      "BLACK\n",
      "2000000\n",
      "4+1\n"
     ]
    }
   ],
   "source": [
    "Verna.showDetails()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Inheritance "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- What is Inheritance ?\n",
    "- Why inheritance ?\n",
    "- How to do Inheritance?\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Tiger \n",
    "class Tiger():\n",
    "    weight = 0\n",
    "    age = 0\n",
    "    breed = \"\"\n",
    "    legs = 0\n",
    "    gender = \"\"\n",
    "    def __init__(self, weight,age,breed,legs,gender):\n",
    "        print(\"Hey Tiger Object is been Created\")\n",
    "        self.weight = weight\n",
    "        self.age = age\n",
    "        self.breed = breed\n",
    "        self.legs = legs \n",
    "        self.gender = gender\n",
    "\n",
    "    def speaks(self):\n",
    "        print(\"Tiger speaks - Roar\")\n",
    "        print(self.age)\n",
    "        \n",
    "    def eat(self):\n",
    "        print(\"Tiger Eats - Animals\")\n",
    "    \n",
    "#Peacock\n",
    "class Peacock():\n",
    "    weight = 0\n",
    "    age = 0\n",
    "    breed = \"\"\n",
    "    legs = 0\n",
    "    gender = \"\"\n",
    "    def __init__(self, weight,age,breed,legs,gender):\n",
    "        print(\"Hey Peacock Object is been Created\")\n",
    "        self.weight = weight\n",
    "        self.age = age\n",
    "        self.breed = breed\n",
    "        self.legs = legs \n",
    "        self.gender = gender\n",
    "        \n",
    "    def speaks(self):\n",
    "        print(\"Peacocks Sing\")\n",
    "        print(self.age)\n",
    "    \n",
    "    def singing(self):\n",
    "        print(\"This Peacock sings lalalalalalalalalalala\")\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hey Tiger Object is been Created\n"
     ]
    }
   ],
   "source": [
    "tiggy = Tiger(75,12,\"Bengal Tiger\", 4, \"Male\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hey Peacock Object is been Created\n"
     ]
    }
   ],
   "source": [
    "peeeaaay = Peacock(20,5,\"Indian Peacock\",2,\"Female\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tiger speaks - Roar\n",
      "12\n"
     ]
    }
   ],
   "source": [
    "tiggy.speaks()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Peacocks Sing\n",
      "5\n"
     ]
    }
   ],
   "source": [
    "peeeaaay.speaks()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inheritance \n",
    "\n",
    "#Parent Class'\n",
    "class animal():\n",
    "    weight = 0\n",
    "    age = 0\n",
    "    breed = \"\"\n",
    "    legs = 0\n",
    "    gender = \"\"\n",
    "    def __init__(self, weight,age,breed,legs,gender):\n",
    "        self.weight = weight\n",
    "        self.age = age\n",
    "        self.breed = breed\n",
    "        self.legs = legs \n",
    "        self.gender = gender\n",
    "    def age(self):\n",
    "        print(\"Age- \", self.age)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define Child Class for inheriting the properties from parent class "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "class NewTiger(animal):\n",
    "    def __init__(self, weight , age ,breed , legs, gender):\n",
    "        print(\"Tiger Got Created\")\n",
    "        animal.__init__(self, weight,age,breed,legs,gender)\n",
    "    def eat(self):\n",
    "        print(\"Tiger Eats - Animals\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tiger Got Created\n"
     ]
    }
   ],
   "source": [
    "newTiggy = NewTiger(45,7,\"Bengali Tiger\",4,\"male\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tiger Eats - Animals\n"
     ]
    }
   ],
   "source": [
    "newTiggy.eat()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "class NewPeacock(animal):\n",
    "    name = \"\"\n",
    "    def __init__(self, weight , age ,breed , legs, gender,name):\n",
    "        print(\"Peacock Got Created\")\n",
    "        self.name = name\n",
    "        animal.__init__(self, weight,age,breed,legs,gender)\n",
    "    def sings(self):\n",
    "        print(self.name,\"Peacock sings lalallallalalalalalalal\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Peacock Got Created\n"
     ]
    }
   ],
   "source": [
    "newPeeyee = NewPeacock(20,5,\"indian Peacock\",2,\"Female\",\"NewPeeyeee\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NewPeeyeee Peacock sings lalallallalalalalalalal\n"
     ]
    }
   ],
   "source": [
    "newPeeyee.sings()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pass Break Continue "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Speed of the car -  1\n",
      "Speed of the car -  2\n",
      "Speed of the car -  3\n",
      "Speed of the car -  4\n",
      "Speed of the car -  5\n",
      "Speed of the car -  6\n",
      "Speed of the car -  7\n",
      "Speed of the car -  8\n",
      "Speed of the car -  9\n",
      "Speed of the car -  10\n",
      "Speed of the car -  11\n",
      "Speed of the car -  12\n",
      "Speed of the car -  13\n",
      "Speed of the car -  14\n",
      "Speed of the car -  15\n",
      "Speed of the car -  16\n",
      "Speed of the car -  17\n",
      "Speed of the car -  18\n",
      "Speed of the car -  19\n",
      "Speed of the car -  20\n",
      "Speed of the car -  21\n",
      "Speed of the car -  22\n",
      "Speed of the car -  23\n",
      "Speed of the car -  24\n",
      "Speed of the car -  25\n",
      "Speed of the car -  26\n",
      "Speed of the car -  27\n",
      "Speed of the car -  28\n",
      "Speed of the car -  29\n",
      "Speed of the car -  30\n",
      "Speed of the car -  31\n",
      "Speed of the car -  32\n",
      "Speed of the car -  33\n",
      "Speed of the car -  34\n",
      "Speed of the car -  35\n",
      "Speed of the car -  36\n",
      "Speed of the car -  37\n",
      "Speed of the car -  38\n",
      "Speed of the car -  39\n",
      "Speed of the car -  40\n",
      "Speed of the car -  41\n",
      "Speed of the car -  42\n",
      "Speed of the car -  43\n",
      "Speed of the car -  44\n",
      "Speed of the car -  45\n",
      "Speed of the car -  46\n",
      "Speed of the car -  47\n",
      "Speed of the car -  48\n",
      "Speed of the car -  49\n",
      "Speed of the car -  50\n",
      "Speed of the car -  51\n",
      "Speed of the car -  52\n",
      "Speed of the car -  53\n",
      "Speed of the car -  54\n",
      "Speed of the car -  55\n",
      "Speed of the car -  56\n",
      "Speed of the car -  57\n",
      "Speed of the car -  58\n",
      "Speed of the car -  59\n",
      "Speed of the car -  60\n",
      "Speed of the car -  61\n",
      "Speed of the car -  62\n",
      "Speed of the car -  63\n",
      "Speed of the car -  64\n",
      "Speed of the car -  65\n",
      "Speed of the car -  66\n",
      "Speed of the car -  67\n",
      "Speed of the car -  68\n",
      "Speed of the car -  69\n",
      "My Dad - Break and give me the car i will drive\n"
     ]
    }
   ],
   "source": [
    "#When ever you hit some condition you want to break that \n",
    "#Coding Block or LOOP \n",
    "\n",
    "for item in range(1,150):\n",
    "    if(item == 70):\n",
    "        print(\"My Dad - Break and give me the car i will drive\")\n",
    "        break\n",
    "    else:\n",
    "        print(\"Speed of the car - \", item)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Speed of the car -  1\n",
      "Speed of the car -  2\n",
      "Speed of the car -  3\n",
      "Speed of the car -  4\n",
      "Speed of the car -  5\n",
      "Speed of the car -  6\n",
      "Speed of the car -  7\n",
      "Speed of the car -  8\n",
      "Speed of the car -  9\n",
      "Speed of the car -  10\n",
      "Speed of the car -  11\n",
      "Speed of the car -  12\n",
      "Speed of the car -  13\n",
      "Speed of the car -  14\n",
      "Speed of the car -  15\n",
      "Speed of the car -  16\n",
      "Speed of the car -  17\n",
      "Speed of the car -  18\n",
      "Speed of the car -  19\n",
      "Speed of the car -  20\n",
      "Speed of the car -  21\n",
      "Speed of the car -  22\n",
      "Speed of the car -  23\n",
      "Speed of the car -  24\n",
      "Speed of the car -  25\n",
      "Speed of the car -  26\n",
      "Speed of the car -  27\n",
      "Speed of the car -  28\n",
      "Speed of the car -  29\n",
      "Speed of the car -  30\n",
      "Speed of the car -  31\n",
      "Speed of the car -  32\n",
      "Speed of the car -  33\n",
      "Speed of the car -  34\n",
      "Speed of the car -  35\n",
      "Speed of the car -  36\n",
      "Speed of the car -  37\n",
      "Speed of the car -  38\n",
      "Speed of the car -  39\n",
      "Speed of the car -  40\n",
      "Speed of the car -  41\n",
      "Speed of the car -  42\n",
      "Speed of the car -  43\n",
      "Speed of the car -  44\n",
      "Speed of the car -  45\n",
      "Speed of the car -  46\n",
      "Speed of the car -  47\n",
      "Speed of the car -  48\n",
      "Speed of the car -  49\n",
      "Speed of the car -  50\n",
      "Speed of the car -  51\n",
      "Speed of the car -  52\n",
      "Speed of the car -  53\n",
      "Speed of the car -  54\n",
      "Speed of the car -  55\n",
      "Speed of the car -  56\n",
      "Speed of the car -  57\n",
      "Speed of the car -  58\n",
      "Speed of the car -  59\n",
      "Speed of the car -  60\n",
      "Speed of the car -  61\n",
      "Speed of the car -  62\n",
      "Speed of the car -  63\n",
      "Speed of the car -  64\n",
      "Speed of the car -  65\n",
      "Speed of the car -  66\n",
      "Speed of the car -  67\n",
      "Speed of the car -  68\n",
      "Speed of the car -  69\n",
      "MY Sister = See the Speed Dail, Slow Down\n",
      "Speed of the car -  71\n",
      "Speed of the car -  72\n",
      "Speed of the car -  73\n",
      "Speed of the car -  74\n",
      "Speed of the car -  75\n",
      "Speed of the car -  76\n",
      "Speed of the car -  77\n",
      "Speed of the car -  78\n",
      "Speed of the car -  79\n",
      "Speed of the car -  80\n",
      "Speed of the car -  81\n",
      "Speed of the car -  82\n",
      "Speed of the car -  83\n",
      "Speed of the car -  84\n",
      "Speed of the car -  85\n",
      "Speed of the car -  86\n",
      "Speed of the car -  87\n",
      "Speed of the car -  88\n",
      "Speed of the car -  89\n",
      "Speed of the car -  90\n",
      "Speed of the car -  91\n",
      "Speed of the car -  92\n",
      "Speed of the car -  93\n",
      "Speed of the car -  94\n",
      "Speed of the car -  95\n",
      "Speed of the car -  96\n",
      "Speed of the car -  97\n",
      "Speed of the car -  98\n",
      "Speed of the car -  99\n",
      "MY Sister = Slow down or else I Will call Amaa\n",
      "Speed of the car -  101\n",
      "Speed of the car -  102\n",
      "Speed of the car -  103\n",
      "Speed of the car -  104\n",
      "Speed of the car -  105\n",
      "Speed of the car -  106\n",
      "Speed of the car -  107\n",
      "Speed of the car -  108\n",
      "Speed of the car -  109\n",
      "Speed of the car -  110\n",
      "Speed of the car -  111\n",
      "Speed of the car -  112\n",
      "Speed of the car -  113\n",
      "Speed of the car -  114\n",
      "Speed of the car -  115\n",
      "Speed of the car -  116\n",
      "Speed of the car -  117\n",
      "Speed of the car -  118\n",
      "Speed of the car -  119\n",
      "Speed of the car -  120\n",
      "Speed of the car -  121\n",
      "Speed of the car -  122\n",
      "Speed of the car -  123\n",
      "Speed of the car -  124\n",
      "Speed of the car -  125\n",
      "Speed of the car -  126\n",
      "Speed of the car -  127\n",
      "Speed of the car -  128\n",
      "Speed of the car -  129\n",
      "Speed of the car -  130\n",
      "Speed of the car -  131\n",
      "Speed of the car -  132\n",
      "Speed of the car -  133\n",
      "Speed of the car -  134\n",
      "Speed of the car -  135\n",
      "Speed of the car -  136\n",
      "Speed of the car -  137\n",
      "Speed of the car -  138\n",
      "Speed of the car -  139\n",
      "Speed of the car -  140\n",
      "Speed of the car -  141\n",
      "Speed of the car -  142\n",
      "Speed of the car -  143\n",
      "Speed of the car -  144\n",
      "Speed of the car -  145\n",
      "Speed of the car -  146\n",
      "Speed of the car -  147\n",
      "Speed of the car -  148\n",
      "Speed of the car -  149\n"
     ]
    }
   ],
   "source": [
    "for item in range(1,150):\n",
    "    if(item == 70):\n",
    "        print(\"MY Sister = See the Speed Dail, Slow Down\")\n",
    "        continue\n",
    "    elif item == 100:\n",
    "        print(\"MY Sister = Slow down or else I Will call Amaa\")\n",
    "        continue\n",
    "    else:\n",
    "        print(\"Speed of the car - \", item)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "unexpected EOF while parsing (<ipython-input-62-b128b5c50a3b>, line 4)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  File \u001b[0;32m\"<ipython-input-62-b128b5c50a3b>\"\u001b[0;36m, line \u001b[0;32m4\u001b[0m\n\u001b[0;31m    # I dont know logic yet, But i know this function is required\u001b[0m\n\u001b[0m                                                                  ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unexpected EOF while parsing\n"
     ]
    }
   ],
   "source": [
    "# Pass \n",
    "\n",
    "def isSomeoneWinner():\n",
    "    # I dont know logic yet, But i know this function is required "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "def isSomeoneWinner():\n",
    "    # I dont know logic yet, But i know this function is required \n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
